package com.haq.housesystem.filters;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class FilterConfiguration {

    @Bean
    public FilterRegistrationBean refererFilterRegistration() {
        FilterRegistrationBean  registration = new FilterRegistrationBean();
        //注入过滤器
        registration.setFilter(new MyFilter());
        //过滤规则
        registration.addUrlPatterns("/*");//   /users/*
        //过滤器名称
        registration.setName("myfilter");
        //过滤器顺序   值越小优先级别越高
        registration.setOrder(1);
        return registration;
    }

}
